package common.lambda.stream;

import java.util.Objects;

/**
 * @author zhang hao dong
 * @date 2025-04-08 14:22
 */
public class PersonKey {
    private String firstName;
    private String lastName;
    private int age;
    private String city;
    private String country;

    public PersonKey(String firstName, String lastName, int age, String city, String country) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.age = age;
        this.city = city;
        this.country = country;
    }

    // Getters, setters, hashCode, equals, and toString methods
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PersonKey that = (PersonKey) o;
        return age == that.age &&
                Objects.equals(firstName, that.firstName) &&
                Objects.equals(lastName, that.lastName) &&
                Objects.equals(city, that.city) &&
                Objects.equals(country, that.country);
    }

    @Override
    public int hashCode() {
        return Objects.hash(firstName, lastName, age, city, country);
    }

    @Override
    public String toString() {
        return "PersonKey{" +
                "firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                ", age=" + age +
                ", city='" + city + '\'' +
                ", country='" + country + '\'' +
                '}';
    }
}
